stackFiles
Type
property
Summary
Specifies a list of stacks and their file names, to be used when a stack that's not open is referenced in a handler.
Syntax
set the stackFiles of <stack> to <stackFileList>
Description
Use the stackFiles property to make one or more stacks accessible to handlers, even if the stack is not already open or in memory.
Each stack reference consists of the short name of a stack, a comma, and the name of the file that contains that stack. (Do not put a space after the comma, unless the file name starts with a space.)
By default, the stackFiles property of newly created stacks is set to empty.
When a handler or object refers to an object in a stack other than the current stack, LiveCode checks all stacks that are loaded into memory (and their substacks) to find the referenced stack. If the stack cannot be found, LiveCode checks the current stack's stackFiles property to locate the stack being referenced, and loaded into memory|loads it into memory so that its properties and the objects in it can be used.
For example, if your stack contains a statement like this, the stack "Customers" must either be loaded into memory, or be listed in the stackFiles, in order for LiveCode to know where it is:
get the width of field \"Text\" of card \"Data\" of stack \"Customers\"
In this example, if the "Customers" stack is not open and isn't in the stackFiles, the statement must refer to it by its full long name, including its file path:
get the width of field \"Text\" of card \"Data\" of stack \"Customers\" \
of stack \"/Volumes/Data/Business.livecode\"
Using the stackFiles lets you simply specify the stack's name, instead of including its file path everywhere you refer to an object in the stack.
The stackFiles of a main stack is inherited by its substacks: if a handler in a substack refers to a stack that's not loaded, LiveCode checks the stackFiles of both the substack and its main stack.
Relative file paths in the stackFiles start from the folder that the stack is in, rather than starting from the defaultFolder as with other relative paths in LiveCode.
Placing a stack in the stackFiles lets handlers in your stack refer to objects in the referenced stack, but does not automatically allow handlers in your stack to call handlers in the referenced stack's scripts. To use a stack as a library, allowing your handlers to call the stack's handlers, use the start using or insert script command.
Examples
set the stackFiles of this stack to "My Dialog,Custom Dialogs.livecode"
Related
function: mainStacks, stacks
glossary: call, command, file path, folder, handler, LiveCode, load, loaded into memory, main stack, object, property, relative file path, script, statement, substack
library: library
object: stack
property: defaultFolder, filename of stack, mainStack, name, properties, substacks
command: insert script, start using
Compatibility and Support
Introduced
LiveCode 1.0
OS
mac
windows
linux
ios
android
Platforms
desktop
server
mobile